#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>

bool repeatedSubstringPattern(char* s)
{
    char arr[10000] = { 0 };
    char a = s[0];
    arr[0] = a;
    int i = 1;
    int j = 1;
    while (s[j] != '\0')
    {
        if (s[j] != a)
        {
            arr[i++] = s[j];
        }
        else
        {
            break;
        }
        j++;
    }
    int k = i;
    int t = 0;
    arr[i] = '\0';
    int ret = (int)strlen(s);
    while (s[k] != '\0')
    {
        if (arr[t] == '\0')
        {
            t = 0;
        }
        else if (arr[t] == s[k])
        {
            t++;
        }
        else if (arr[t] != s[k])
        {
            return false;
        }
        k++;
    }
    if (t == i)
        return true;


    return false;
}

int main()
{
    char s[100] = "abcabcabcabc";
    bool ret = repeatedSubstringPattern(s);

    return 0;
}

